#!/usr/bin/env python
#
# Copyright 2008 Google Inc.
# Copyright 2010 Joe LaPenna
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

"""Buzz oAuth client."""


import oauth
import oauth_appengine

import buzz

class BuzzOAuthClient(oauth_appengine.OAuthClient):
  """Buzz specific oauth client.

  Per: http://code.google.com/apis/gdata/articles/oauth.html
  """

  REQUEST_TOKEN_URL = buzz.OAUTH_REQUEST_TOKEN_URI
  ACCESS_TOKEN_URL = buzz.OAUTH_ACCESS_TOKEN_URI
  AUTHORIZATION_URL = buzz.OAUTH_AUTHORIZATION_URI

  SCOPE = buzz.FULL_ACCESS_SCOPE

  def __init__(self, oauth_consumer=None, oauth_token=None):
    super(BuzzOAuthClient, self).__init__(
        oauth_consumer=oauth_consumer,
        oauth_token=oauth_token,
        request_token_url=BuzzOAuthClient.REQUEST_TOKEN_URL,
        access_token_url=BuzzOAuthClient.ACCESS_TOKEN_URL,
        authorization_url=BuzzOAuthClient.AUTHORIZATION_URL)
    self.signature_method = oauth.OAuthSignatureMethod_HMAC_SHA1()
